package iface

import "io"

type ApplicationContext interface {
	io.Closer
	BeanFactory

	// RegisterOriginBeans 注册bean对象到容器中
	RegisterOriginBeans(registerBeans []any)

	// AddBeanFactoryPostProcessor 添加Bean工厂增强器
	AddBeanFactoryPostProcessor(postProcessor BeanFactoryPostProcessor)

	// GetBeanFactoryPostProcessors 获取Bean工厂增强器列表
	GetBeanFactoryPostProcessors() []BeanFactoryPostProcessor

	// Refresh 刷新容器
	// 也是gspring容器的入口方法，提供了容器启动的入口
	Refresh()

	// GetParent 获取父类容器
	GetParent() ApplicationContext

	// SetParent 添加父类容器
	SetParent(ApplicationContext)

	// GetBeanFactory 获取Bean工厂
	GetBeanFactory() ListableBeanFactory

	// PrepareRefresh 准备刷新容器，可以在这里做一些容器所需组件的初始化工作
	PrepareRefresh()

	// ObtainFreshBeanFactory 获取新的Bean工厂对象
	ObtainFreshBeanFactory() ListableBeanFactory

	// RefreshBeanFactory 刷新Bean工厂
	RefreshBeanFactory()

	// PrepareBeanFactory 准备Bean工厂
	PrepareBeanFactory(beanFactory ListableBeanFactory)

	// PostProcessorBeanFactory 增强BeanFactory
	PostProcessorBeanFactory(beanFactory ListableBeanFactory)

	// LoadBeanDefinitions 加载bean定义信息
	LoadBeanDefinitions(beanFactory ListableBeanFactory)

	// InvokeBeanFactoryPostProcessors 执行BeanFactory增强器
	InvokeBeanFactoryPostProcessors(beanFactory ListableBeanFactory)

	// RegisterBeanPostProcessors 注册Bean增强器
	RegisterBeanPostProcessors(beanFactory ListableBeanFactory)

	// FinishBeanFactoryInitialization 结束BeanFactory的实例化工作
	FinishBeanFactoryInitialization(beanFactory ListableBeanFactory)

	// IsActive 容器当前是否在激活状态
	IsActive() bool
}
